home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-01-24 | 14.3 KB | 643 lines | [TEXT/MPS ] |
- ;
- ; File: Collections.a
- ;
- ; Contains: Collection Manager Interfaces.
- ;
- ; Version: Technology: Quickdraw GX 1.0
- ; Package: Universal Interfaces 2.2 in “MPW” on ETO #20
- ;
- ; Copyright: © 1984-1995 by Apple Computer, Inc.
- ; All rights reserved.
- ;
- ; Bugs?: If you find a problem with this file, use the Apple Bug Reporter
- ; stack. Include the file and version information (from above)
- ; in the problem description and send to:
- ; Internet: apple.bugs@applelink.apple.com
- ; AppleLink: APPLE.BUGS
- ;
- ;
-
- IF &TYPE('__COLLECTIONS__') = 'UNDEFINED' THEN
- __COLLECTIONS__ SET 1
-
-
- IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
- include 'Types.a'
- ENDIF
- ; include 'ConditionalMacros.a' ;
-
- IF &TYPE('__MIXEDMODE__') = 'UNDEFINED' THEN
- include 'MixedMode.a'
- ENDIF
-
- gestaltCollectionMgrVersion EQU 'cltn'
-
- ; Collection Manager Error Result Codes...
- collectionItemLockedErr EQU -5750
- collectionItemNotFoundErr EQU -5751
- collectionIndexRangeErr EQU -5752
- collectionVersionErr EQU -5753
-
- ; Convenience constants for functions which optionally return values...
- dontWantTag EQU 0
- dontWantId EQU 0
- dontWantSize EQU 0
- dontWantAttributes EQU 0
- dontWantIndex EQU 0
- dontWantData EQU 0
-
- ; attributes bits
- noCollectionAttributes EQU $00000000 ; no attributes bits set
- allCollectionAttributes EQU $FFFFFFFF ; all attributes bits set
- userCollectionAttributes EQU $0000FFFF ; user attributes bits
- defaultCollectionAttributes EQU $40000000 ; default attributes - unlocked, persistent
-
- ;
- ; Attribute bits 0 through 15 (entire low word) are reserved for use by the application.
- ; Attribute bits 16 through 31 (entire high word) are reserved for use by the Collection Manager.
- ; Only bits 31 (collectionLockBit) and 30 (collectionPersistenceBit) currently have meaning.
- ;
- collectionUser0Bit EQU 0
- collectionUser1Bit EQU 1
- collectionUser2Bit EQU 2
- collectionUser3Bit EQU 3
- collectionUser4Bit EQU 4
- collectionUser5Bit EQU 5
- collectionUser6Bit EQU 6
- collectionUser7Bit EQU 7
- collectionUser8Bit EQU 8
- collectionUser9Bit EQU 9
- collectionUser10Bit EQU 10
- collectionUser11Bit EQU 11
- collectionUser12Bit EQU 12
- collectionUser13Bit EQU 13
- collectionUser14Bit EQU 14
- collectionUser15Bit EQU 15
- collectionReserved0Bit EQU 16
- collectionReserved1Bit EQU 17
- collectionReserved2Bit EQU 18
- collectionReserved3Bit EQU 19
- collectionReserved4Bit EQU 20
- collectionReserved5Bit EQU 21
- collectionReserved6Bit EQU 22
- collectionReserved7Bit EQU 23
- collectionReserved8Bit EQU 24
- collectionReserved9Bit EQU 25
- collectionReserved10Bit EQU 26
- collectionReserved11Bit EQU 27
- collectionReserved12Bit EQU 28
- collectionReserved13Bit EQU 29
- collectionPersistenceBit EQU 30
- collectionLockBit EQU 31
-
- ; attribute masks
- collectionUser0Mask EQU 1 << collectionUser0Bit
- collectionUser1Mask EQU 1 << collectionUser1Bit
- collectionUser2Mask EQU 1 << collectionUser2Bit
- collectionUser3Mask EQU 1 << collectionUser3Bit
- collectionUser4Mask EQU 1 << collectionUser4Bit
- collectionUser5Mask EQU 1 << collectionUser5Bit
- collectionUser6Mask EQU 1 << collectionUser6Bit
- collectionUser7Mask EQU 1 << collectionUser7Bit
- collectionUser8Mask EQU 1 << collectionUser8Bit
- collectionUser9Mask EQU 1 << collectionUser9Bit
- collectionUser10Mask EQU 1 << collectionUser10Bit
- collectionUser11Mask EQU 1 << collectionUser11Bit
- collectionUser12Mask EQU 1 << collectionUser12Bit
- collectionUser13Mask EQU 1 << collectionUser13Bit
- collectionUser14Mask EQU 1 << collectionUser14Bit
- collectionUser15Mask EQU 1 << collectionUser15Bit
- collectionReserved0Mask EQU 1 << collectionReserved0Bit
- collectionReserved1Mask EQU 1 << collectionReserved1Bit
- collectionReserved2Mask EQU 1 << collectionReserved2Bit
- collectionReserved3Mask EQU 1 << collectionReserved3Bit
- collectionReserved4Mask EQU 1 << collectionReserved4Bit
- collectionReserved5Mask EQU 1 << collectionReserved5Bit
- collectionReserved6Mask EQU 1 << collectionReserved6Bit
- collectionReserved7Mask EQU 1 << collectionReserved7Bit
- collectionReserved8Mask EQU 1 << collectionReserved8Bit
- collectionReserved9Mask EQU 1 << collectionReserved9Bit
- collectionReserved10Mask EQU 1 << collectionReserved10Bit
- collectionReserved11Mask EQU 1 << collectionReserved11Bit
- collectionReserved12Mask EQU 1 << collectionReserved12Bit
- collectionReserved13Mask EQU 1 << collectionReserved13Bit
- collectionPersistenceMask EQU 1 << collectionPersistenceBit
- collectionLockMask EQU 1 << collectionLockBit
-
- ;*********
- ; Types
- ;*********
- ; abstract data type for a collection
- ; typedef FourCharCode CollectionTag
- ;
- ; pascal Collection NewCollection(void)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _NewCollection
- moveq #0,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION NewCollection
- ENDIF
-
- ;
- ; pascal void DisposeCollection(Collection c)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _DisposeCollection
- moveq #1,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION DisposeCollection
- ENDIF
-
- ;
- ; pascal Collection CloneCollection(Collection c)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _CloneCollection
- moveq #2,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION CloneCollection
- ENDIF
-
- ;
- ; pascal long CountCollectionOwners(Collection c)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _CountCollectionOwners
- moveq #3,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION CountCollectionOwners
- ENDIF
-
- ;
- ; pascal Collection CopyCollection(Collection srcCollection, Collection dstCollection)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _CopyCollection
- moveq #4,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION CopyCollection
- ENDIF
-
- ;
- ; pascal long GetCollectionDefaultAttributes(Collection c)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _GetCollectionDefaultAttributes
- moveq #5,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION GetCollectionDefaultAttributes
- ENDIF
-
- ;
- ; pascal void SetCollectionDefaultAttributes(Collection c, long whichAttributes, long newAttributes)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _SetCollectionDefaultAttributes
- moveq #6,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION SetCollectionDefaultAttributes
- ENDIF
-
- ;
- ; pascal long CountCollectionItems(Collection c)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _CountCollectionItems
- moveq #7,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION CountCollectionItems
- ENDIF
-
- ;
- ; pascal OSErr AddCollectionItem(Collection c, CollectionTag tag, long id, long itemSize, void *itemData)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _AddCollectionItem
- moveq #8,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION AddCollectionItem
- ENDIF
-
- ;
- ; pascal OSErr GetCollectionItem(Collection c, CollectionTag tag, long id, long *itemSize, void *itemData)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _GetCollectionItem
- moveq #9,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION GetCollectionItem
- ENDIF
-
- ;
- ; pascal OSErr RemoveCollectionItem(Collection c, CollectionTag tag, long id)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _RemoveCollectionItem
- moveq #10,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION RemoveCollectionItem
- ENDIF
-
- ;
- ; pascal OSErr SetCollectionItemInfo(Collection c, CollectionTag tag, long id, long whichAttributes, long newAttributes)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _SetCollectionItemInfo
- moveq #11,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION SetCollectionItemInfo
- ENDIF
-
- ;
- ; pascal OSErr GetCollectionItemInfo(Collection c, CollectionTag tag, long id, long *index, long *itemSize, long *attributes)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _GetCollectionItemInfo
- moveq #12,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION GetCollectionItemInfo
- ENDIF
-
- ;
- ; pascal OSErr ReplaceIndexedCollectionItem(Collection c, long index, long itemSize, void *itemData)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _ReplaceIndexedCollectionItem
- moveq #13,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION ReplaceIndexedCollectionItem
- ENDIF
-
- ;
- ; pascal OSErr GetIndexedCollectionItem(Collection c, long index, long *itemSize, void *itemData)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _GetIndexedCollectionItem
- moveq #14,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION GetIndexedCollectionItem
- ENDIF
-
- ;
- ; pascal OSErr RemoveIndexedCollectionItem(Collection c, long index)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _RemoveIndexedCollectionItem
- moveq #15,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION RemoveIndexedCollectionItem
- ENDIF
-
- ;
- ; pascal OSErr SetIndexedCollectionItemInfo(Collection c, long index, long whichAttributes, long newAttributes)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _SetIndexedCollectionItemInfo
- moveq #16,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION SetIndexedCollectionItemInfo
- ENDIF
-
- ;
- ; pascal OSErr GetIndexedCollectionItemInfo(Collection c, long index, CollectionTag *tag, long *id, long *itemSize, long *attributes)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _GetIndexedCollectionItemInfo
- moveq #17,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION GetIndexedCollectionItemInfo
- ENDIF
-
- ;
- ; pascal Boolean CollectionTagExists(Collection c, CollectionTag tag)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _CollectionTagExists
- moveq #18,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION CollectionTagExists
- ENDIF
-
- ;
- ; pascal long CountCollectionTags(Collection c)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _CountCollectionTags
- moveq #19,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION CountCollectionTags
- ENDIF
-
- ;
- ; pascal OSErr GetIndexedCollectionTag(Collection c, long tagIndex, CollectionTag *tag)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _GetIndexedCollectionTag
- moveq #20,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION GetIndexedCollectionTag
- ENDIF
-
- ;
- ; pascal long CountTaggedCollectionItems(Collection c, CollectionTag tag)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _CountTaggedCollectionItems
- moveq #21,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION CountTaggedCollectionItems
- ENDIF
-
- ;
- ; pascal OSErr GetTaggedCollectionItem(Collection c, CollectionTag tag, long whichItem, long *itemSize, void *itemData)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _GetTaggedCollectionItem
- moveq #22,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION GetTaggedCollectionItem
- ENDIF
-
- ;
- ; pascal OSErr GetTaggedCollectionItemInfo(Collection c, CollectionTag tag, long whichItem, long *id, long *index, long *itemSize, long *attributes)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _GetTaggedCollectionItemInfo
- moveq #23,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION GetTaggedCollectionItemInfo
- ENDIF
-
- ;
- ; pascal void PurgeCollection(Collection c, long whichAttributes, long matchingAttributes)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _PurgeCollection
- moveq #24,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION PurgeCollection
- ENDIF
-
- ;
- ; pascal void PurgeCollectionTag(Collection c, CollectionTag tag)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _PurgeCollectionTag
- moveq #25,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION PurgeCollectionTag
- ENDIF
-
- ;
- ; pascal void EmptyCollection(Collection c)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _EmptyCollection
- moveq #26,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION EmptyCollection
- ENDIF
-
- ;
- ; pascal OSErr FlattenCollection(Collection c, CollectionFlattenUPP flattenProc, void *refCon)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _FlattenCollection
- moveq #27,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION FlattenCollection
- ENDIF
-
- ;
- ; pascal OSErr FlattenPartialCollection(Collection c, CollectionFlattenUPP flattenProc, void *refCon, long whichAttributes, long matchingAttributes)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _FlattenPartialCollection
- moveq #28,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION FlattenPartialCollection
- ENDIF
-
- ;
- ; pascal OSErr UnflattenCollection(Collection c, CollectionFlattenUPP flattenProc, void *refCon)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _UnflattenCollection
- moveq #29,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION UnflattenCollection
- ENDIF
-
- ;
- ; pascal CollectionExceptionUPP GetCollectionExceptionProc(Collection c)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _GetCollectionExceptionProc
- moveq #30,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION GetCollectionExceptionProc
- ENDIF
-
- ;
- ; pascal void SetCollectionExceptionProc(Collection c, CollectionExceptionUPP exceptionProc)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _SetCollectionExceptionProc
- moveq #31,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION SetCollectionExceptionProc
- ENDIF
-
- ;***************************************************************************************
- ; Utility Routines for handle-based access...
- ;***************************************************************************************
- ;
- ; pascal Collection GetNewCollection(short collectionID)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _GetNewCollection
- moveq #32,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION GetNewCollection
- ENDIF
-
- ;
- ; pascal OSErr AddCollectionItemHdl(Collection aCollection, CollectionTag tag, long id, Handle itemData)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _AddCollectionItemHdl
- moveq #33,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION AddCollectionItemHdl
- ENDIF
-
- ;
- ; pascal OSErr GetCollectionItemHdl(Collection aCollection, CollectionTag tag, long id, Handle itemData)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _GetCollectionItemHdl
- moveq #34,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION GetCollectionItemHdl
- ENDIF
-
- ;
- ; pascal OSErr ReplaceIndexedCollectionItemHdl(Collection aCollection, long index, Handle itemData)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _ReplaceIndexedCollectionItemHdl
- moveq #35,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION ReplaceIndexedCollectionItemHdl
- ENDIF
-
- ;
- ; pascal OSErr GetIndexedCollectionItemHdl(Collection aCollection, long index, Handle itemData)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _GetIndexedCollectionItemHdl
- moveq #36,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION GetIndexedCollectionItemHdl
- ENDIF
-
- ;
- ; pascal OSErr FlattenCollectionToHdl(Collection aCollection, Handle flattened)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _FlattenCollectionToHdl
- moveq #37,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION FlattenCollectionToHdl
- ENDIF
-
- ;
- ; pascal OSErr UnflattenCollectionFromHdl(Collection aCollection, Handle flattened)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _UnflattenCollectionFromHdl
- moveq #38,d0
- dc.w $ABF6
- EndM
- ELSE
- IMPORT_CFM_FUNCTION UnflattenCollectionFromHdl
- ENDIF
-
- ENDIF ; __COLLECTIONS__
-